<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="generator" CONTENT="http://txt2tags.org">
<LINK REL="stylesheet" TYPE="text/css" HREF="userguide.css">
<TITLE>Txt2tags User Guide</TITLE>
</HEAD>
<BODY>

<DIV CLASS="header" ID="header">


</DIV>

<DIV CLASS="body" ID="body">

<H1>About</H1>

<P>
This is the <A HREF="http://txt2tags.org">txt2tags</A> User Guide, the
complete manual about the program.
</P>

<UL>
<LI>User Guide official address:
  <A HREF="http://txt2tags.org/userguide">http://txt2tags.org/userguide</A>
<P></P>
<LI>User Guide PDF download:
  <A HREF="http://txt2tags.org/userguide/userguide.pdf">http://txt2tags.org/userguide/userguide.pdf</A>
</UL>

<A NAME="intro"></A>
<H1>Part I - Introducing Txt2tags</H1>

<A NAME="1st-questions"></A>
<H2>The First Questions You May Have</H2>

<P>
This chapter is a txt2tags overview, that will introduce the program
purpose and features.
</P>

<H3>What is it?</H3>

<P>
Txt2tags is a text formatting and conversion tool.
</P>
<P>
Txt2tags converts a plain text file with little marks, to any
of the supported targets:
</P>

<UL>
<LI>HTML document
<LI>XHTML document
<LI>SGML document
<LI>DocBook document
<LI>LaTeX document
<LI>Lout document
<LI>UNIX man page
<LI>MagicPoint presentation
<LI>Creole 1.0 document
<LI>Wikipedia page (MediaWiki)
<LI>Google Wiki page
<LI>PmWiki page
<LI>DokuWiki page
<LI>MoinMoin page
<LI>PageMaker 6.0 document
<LI>AsciiDoc document
<LI>ASCII Art text
<LI>Plain Text (no marks)
</UL>

<H3>Why should I use it?</H3>

<P>
You'll find txt2tags really useful if you:
</P>

<UL>
<LI>Need to publish documents in different formats
<LI>Need to maintain updated documents in different formats
<LI>Write technical documents or guides
<LI>Don't know how to write a document in a specific format
<LI>Don't have an editor for a specific format
<LI>Want to use a simple text editor to update your documents
</UL>

<P>
And the main motivation is:
</P>

<UL>
<LI>Save time, writing <B>contents</B> and forgetting about <B>formatting</B>
</UL>

<H3>Why is it a good choice among other tools?</H3>

<P>
Txt2tags has a very straight way of growing, following basic concepts.
These are the highlights:
</P>

<TABLE>
<TR>
<TD><I>Source File Readable</I></TD>
<TD>Txt2tags marks are very simple, almost natural.</TD>
</TR>
<TR>
<TD><I>Target Document Readable</I></TD>
<TD>The target document is also readable, with indentation and spacing.</TD>
</TR>
<TR>
<TD><I>Consistent Marks</I></TD>
<TD>Txt2tags marks are simple symbols, designed to be unique enough to don't mix up with the document contents.</TD>
</TR>
<TR>
<TD><I>Consistent Rules</I></TD>
<TD>As the marks, the rules that applies to them are tied to each other, there are no "exceptions" or "special cases".</TD>
</TR>
<TR>
<TD><I>Simple Structures</I></TD>
<TD>All the supported formatting are <B>simple</B>, with no extra-options or complicated behavior modifiers. A mark is just a mark, with no options at all.</TD>
</TR>
<TR>
<TD><I>Easy to Learn</I></TD>
<TD>With simple marks and readable source, the txt2tags learning curve is user friendly.</TD>
</TR>
<TR>
<TD><I>Nice Examples</I></TD>
<TD>The <B>sample files</B> included on the package gives real life examples of documents written for txt2tags.</TD>
</TR>
<TR>
<TD><I>Valuable Tools</I></TD>
<TD>The <B>syntax files</B> included on the package help you to write documents with no syntax errors.</TD>
</TR>
<TR>
<TD><I>Three User Interfaces</I></TD>
<TD>There is a user friendly <B>Graphical interface</B>, a handy <B>Web interface</B> easy to install in intranets and a <B>Command Line interface</B> for power-users and scripting.</TD>
</TR>
<TR>
<TD><I>Scripting</I></TD>
<TD>With the full featured command line mode, an experienced user can <B>automatize</B> tasks and do <B>post-editing</B> on the converted files.</TD>
</TR>
<TR>
<TD><I>Download and Run / Multi-platform</I></TD>
<TD>Txt2tags is a single <B>Python script</B>. There is no need to compile it or download extra modules. So it runs nicely on *NIX, Linux, Windows and Macs.</TD>
</TR>
<TR>
<TD><I>Mature</I></TD>
<TD>First released in 2001, txt2tags is now a mature program with years of improvements and bug fixes, extensive documentation, translations and an loyal user base.</TD>
</TR>
</TABLE>

<H3>Do I have to pay for it?</H3>

<P>
Absolutely NO!
</P>
<P>
It's free, GPL licensed.
</P>

<A NAME="structures"></A>
<H2>Supported Formatting Structures</H2>

<P>
The following is a list of all the structures supported by txt2tags.
</P>

<UL>
<LI>header (document title, author name, date)
<LI>section title (numbered or not)
<LI>paragraphs
<LI>font beautifiers
  <UL>
  <LI>bold
  <LI>italic
  <LI>underline
  <LI>strike
  </UL>
<LI>monospaced font (verbatim)
  <UL>
  <LI>monospaced inside paragraph
  <LI>monospaced line
  <LI>monospaced area (multiline)
  </UL>
<LI>quoted area
<LI>link
  <UL>
  <LI>URL/Internet links
  <LI>e-mail links
  <LI>local links
  <LI>named links
  </UL>
<LI>lists
  <UL>
  <LI>bulleted list
  <LI>numbered list
  <LI>definition list
  </UL>
<LI>horizontal separator line
<LI>image (with smart alignment)
<LI>table (with or without border, smart alignment, column span)
<LI>macros (with flexible formatting):
  <UL>
  <LI>current date
  <LI>file modification time
  <LI>input and output file name and path
  <LI>automatic table of contents
  </UL>
<LI>special mark for raw text (no marks parsed inside)
<LI>special mark for tagged text (no parsing, sent directly to output)
<LI>comments (for self notes, TODO, FIXME)
</UL>

<A NAME="targets"></A>
<H2>Supported Targets</H2>

<DL>
<DT><B>HTML</B></DT><DD>
  Everybody knows what HTML is. (hint: Internet)
<P></P>
  Txt2tags generates clean HTML documents, that look pretty and have
  its source readable. It DOES NOT use javascript, frames or other
  futile formatting techniques, that aren't required for simple, techie
  documents. But a separate CSS file can be used if wanted. Txt2tags
  generates "<I>HTML 4.0 Transitional</I>" code.
<P></P>
  Txt2tags HTML generated code is 100% approved by the <A HREF="http://validator.w3.org/">w3c validator</A>.
<P></P>
<DT><B>XHTML</B></DT><DD>
  It is the new generation of HTML, with more strict rules.
  This makes the code easier to parse and
  understand. For the general purpose, consider it HTML. Txt2tags
  generates "<I>XHTML 1.0 Transitional</I>" code.
<P></P>
  Txt2tags XHTML generated code is 100% approved by the <A HREF="http://validator.w3.org/">w3c validator</A>.
<P></P>
<DT><B>SGML</B></DT><DD>
  It is a common document format which has powerful conversion applications
  (<A HREF="http://packages.debian.org/linuxdoc-tools">linuxdoc-tools</A>). From a
  single SGML file you can generate HTML, PDF, PostScript, Info, LaTeX, LyX, RTF
  and XML documents. The tools also does automatic TOC and break
  sections into subpages.
<P></P>
  Txt2tags generates SGML files in the LinuxDoc system type, ready to
  be converted with linuxdoc-tools without any extra catalog files or any
  SGML annoying requirements.
<P></P>
<DT><B>LATEX</B></DT><DD>
  The preferred academic document format, it is more powerful than you
  ever wondered. Full books, complicated formulas and any complex text
  can be written in LaTeX. But prepare to loose your hair when you try
  to write the tags by hand...
<P></P>
  Txt2tags generates ready-to-use LaTeX files, doing all the complex
  escaping tricks and exceptions. The writer just need to worry about
  the text.
<P></P>
<DT><B>LOUT</B></DT><DD>
  Very similar to LaTeX in power, but with an easier syntax using "@"
  instead "\" and avoiding the need of braces in common situations. Its
  approach of everything-is-an-object makes the tagging much saner.
<P></P>
  Txt2tags generates ready-to-use Lout files, which can be converted do
  PS or PDF files using the "lout" command.
<P></P>
<DT><B>MAN</B></DT><DD>
  UNIX man pages resist over the years. Document formats come and go,
  and there they are, unbeatable.
<P></P>
  There are other tools to generate man documents, but txt2tags has
  one advantage: one source, multi targets. So the same man page
  contents can be converted to an HTML page, Wiki document and plain text.
<P></P>
<DT><B>MGP</B></DT><DD>
  <A HREF="http://en.wikipedia.org/wiki/MagicPoint">MagicPoint</A> is a very handy presentation tool
  (hint: Microsoft PowerPoint), that uses a tagged language to define all
  the screens. So you can do complex presentations in vi/emacs/notepad.
<P></P>
  Txt2tags generates a ready-to-use .mgp file, defining all the
  necessary headers for fonts and appearance definitions, as long as
  international characters support.
<P></P>
  Txt2tags creates "diet" .mgp files: they use the Type1 fonts, so you do not
  need to carry TrueType fonts files with your presentation. Also, the color
  definitions are simple, so even on a poor color palette system (such as
  <CODE>startx -- -bpp 8</CODE>), the presentation will look pretty!
<P></P>
  The key is: convert and use. No quick fixes or requirements needed.
<P></P>
<DT><B>WIKI</B></DT><DD>
  You've heard about the <A HREF="http://wikipedia.org">Wikipedia</A>, right? So you
  don't need to learn yet-another markup syntax. Just stick with txt2tags
  and let it convert your text to the Wikipedia format, called
  <A HREF="http://en.wikipedia.org/wiki/MediaWiki">MediaWiki</A>.
<P></P>
<DT><B>GWIKI</B></DT><DD>
  Now you can easily paste your project's current documentation into the
  <A HREF="http://code.google.com/">Google Code</A> Wiki.
<P></P>
<DT><B>DOKU</B></DT><DD>
  <A HREF="http://www.dokuwiki.org/dokuwiki">DokuWiki</A> is a standards
  compliant, simple to use Wiki, mainly aimed at creating documentation
  of any kind. It is targeted at developer teams, workgroups and small
  companies. It has a simple but powerful syntax which makes sure the
  data files remain readable outside the Wiki and eases the creation of
  structured texts. All data is stored in plain text files - no
  database is required.
<P></P>
<DT><B>MOIN</B></DT><DD>
  You don't know what <A HREF="http://moinmo.in/">MoinMoin</A> is?
  It is a <A HREF="http://www.c2.com/cgi/wiki">WikiWiki</A>!
<P></P>
  Moin syntax is kinda boring when you need to keep
  <CODE>{{{'''''adding braces and quotes'''''}}}</CODE>, so txt2tags comes with the
  simplified marks and unified solution: one source, multi targets.
<P></P>
<DT><B>PM6</B></DT><DD>
  Adobe PageMaker 6.0 has its own tagged
  language. Styles, color table, beautifiers, and most of all the
  PageMaker mouse-clicking features are also available on its tagged language.
  You just need to access the "Import tagged text" menu item. Just for
  the records, it's an &lt;HTML "like"&gt; tag format.
<P></P>
  Txt2tags generates all the tags and already defines a extensive and
  working header, setting paragraph styles and formatting. This is the
  hard part.
<P></P>
  <B>Author's note:</B>
  My entire portuguese <A HREF="http://guia-er.sf.net">regular expression's book</A>
  was written in VI, then converted to PageMaker with txt2tags and went to
  the publisher. It works :)
<P></P>
<DT><B>TXT</B></DT><DD>
  TXT is text. Simple, pure, beautiful.
<P></P>
  Although txt2tags marks are very intuitive and discrete, you can remove
  them by converting the file to pure TXT.
<P></P>
  The titles are underlined, and the text is basically left as is on the
  source.
</DL>

<P>
Tip: Use the <CODE>--targets</CODE> command line option to get a complete list of
all the available targets.
</P>

<A NAME="struct-support"></A>
<H2>Status of Supported Structures by Target</H2>

<TABLE ALIGN="center" BORDER="1">
<TR>
<TH>Structure</TH>
<TH>html</TH>
<TH>xhtml</TH>
<TH>sgml</TH>
<TH>dbk</TH>
<TH>tex</TH>
<TH>lout</TH>
<TH>man</TH>
<TH>mgp</TH>
<TH>creole</TH>
<TH>wiki</TH>
<TH>gwiki</TH>
<TH>pmw</TH>
<TH>doku</TH>
<TH>moin</TH>
<TH>pm6</TH>
<TH>adoc</TH>
<TH>art</TH>
<TH>txt</TH>
</TR>
<TR>
<TD>headers</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
</TR>
<TR>
<TD>section title</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
</TR>
<TR>
<TD>paragraphs</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
</TR>
<TR>
<TD>bold</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
</TR>
<TR>
<TD>italic</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
</TR>
<TR>
<TD>underline</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
</TR>
<TR>
<TD>strike</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
</TR>
<TR>
<TD>monospaced font</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
</TR>
<TR>
<TD>verbatim line</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
</TR>
<TR>
<TD>verbatim area</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
</TR>
<TR>
<TD>quoted area</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
</TR>
<TR>
<TD>internet links</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
</TR>
<TR>
<TD>e-mail links</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
</TR>
<TR>
<TD>local links</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
</TR>
<TR>
<TD>named links</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
</TR>
<TR>
<TD>bulleted list</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
</TR>
<TR>
<TD>numbered list</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
</TR>
<TR>
<TD>definition list</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
</TR>
<TR>
<TD>horizontal line</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
</TR>
<TR>
<TD>image</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
</TR>
<TR>
<TD>table</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
</TR>
<TR>
<TH>Extras</TH>
<TH>html</TH>
<TH>xhtml</TH>
<TH>sgml</TH>
<TH>dbk</TH>
<TH>tex</TH>
<TH>lout</TH>
<TH>man</TH>
<TH>mgp</TH>
<TH>creole</TH>
<TH>wiki</TH>
<TH>gwiki</TH>
<TH>pmw</TH>
<TH>doku</TH>
<TH>moin</TH>
<TH>pm6</TH>
<TH>adoc</TH>
<TH>art</TH>
<TH>txt</TH>
</TR>
<TR>
<TD>image align</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">-</TD>
</TR>
<TR>
<TD>table cell align</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
</TR>
<TR>
<TD>table column span</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">Y</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">-</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
<TD ALIGN="center">N</TD>
</TR>
</TABLE>

<TABLE ALIGN="center">
<TR>
<TH></TH>
<TH>Legend</TH>
</TR>
<TR>
<TD><B>Y</B></TD>
<TD><I>Supported</I></TD>
</TR>
<TR>
<TD><B>N</B></TD>
<TD><I>Not supported (may be in future releases)</I></TD>
</TR>
<TR>
<TD><B>-</B></TD>
<TD><I>Not supported (can't be done on this target)</I></TD>
</TR>
</TABLE>

<A NAME="interfaces"></A>
<H2>The Three User Interfaces: Gui, Web and Command Line</H2>

<P>
As different users have different needs and environments, txt2tags is
very flexible on how it runs.
</P>
<P>
There are three User Interfaces for the program, each one with its own
purpose and features.
</P>

<UL>
<LI><B>Gui</B>: Written in Tk, brings the windowing and clicking to txt2tags.
<LI><B>Web</B>: Written in PHP, allows users to run txt2tags on the browser,
           requiring no installation on the client side.
<LI><B>Command Line</B>: Written in Python, it's the program core. All
           features are available as command line options.
</UL>

<A NAME="gui"></A>
<H3>Graphical Interface</H3>

<P>
Since version 1.0, there is a nice Graphical Interface, that works on
Linux, Windows, Mac and others. Just call txt2tags with the <CODE>--gui</CODE>
option to open it.
</P>
<P>
The interface is pretty simple and intuitive:
</P>
                     <center><IMG ALIGN="middle" SRC="./gui.png" BORDER="0" ALT=""></center>  

<OL>
<LI>You locate the source .t2t file on the disk and its options are
  loaded.
<P></P>
<LI>If the target is still empty, you must choose one.
<P></P>
<LI>Then there are some options you may choose, but none of them are
  required.
<P></P>
<LI>Finally, press the "Convert!" button.
</OL>

<P>
A nice option is the "<I>Dump to screen</I>", so you can check
the resulting code on a separate window, no file is saved at all. When
the code is OK, you uncheck it and the file will be saved.
</P>
<P>
The default interface colors can be changed on the <A HREF="#rc">configuration file</A>,
using the <CODE>%!guicolors</CODE> settings. For example:
</P>

<PRE>
% set my own colors for the graphical interface (bg1, fg1, bg2, fg2)
%!guicolors: blue white brown yellow
</PRE>

<H3>Web Interface</H3>

<P>
The Web Interface is up and running on the Internet at
<A HREF="http://txt2tags.org/online.php">http://txt2tags.org/online.php</A>, so you can use and test the program
instantly, before download.
</P>
          <center><IMG ALIGN="middle" SRC="./web.png" BORDER="0" ALT=""></center>  
<P>
One can also put this interface on the local intranet avoiding to
install txt2tags in all machines.
</P>

<A NAME="cmdline"></A>
<H3>Command Line Interface</H3>

<P>
For command line power users, the --help should be enough:
</P>

<PRE>
Usage: txt2tags [OPTIONS] [infile.t2t ...]

      --targets       print a list of all the available targets and exit
  -t, --target=TYPE   set target document type. currently supported:
                      adoc, art, creole, dbk, doku, gwiki, html, lout, man,
                      mgp, moin, pm6, pmw, sgml, tex, txt, wiki, xhtml
  -i, --infile=FILE   set FILE as the input file name ('-' for STDIN)
  -o, --outfile=FILE  set FILE as the output file name ('-' for STDOUT)
      --encoding=ENC  set target file encoding (utf-8, iso-8859-1, etc)
      --toc           add an automatic Table of Contents to the output
      --toc-level=N   set maximum TOC level (depth) to N
      --toc-only      print the Table of Contents and exit
  -n, --enum-title    enumerate all titles as 1, 1.1, 1.1.1, etc
      --style=FILE    use FILE as the document style (like HTML CSS)
      --css-sugar     insert CSS-friendly tags for HTML/XHTML
      --css-inside    insert CSS file contents inside HTML/XHTML headers
  -H, --no-headers    suppress header and footer from the output
      --mask-email    hide email from spam robots. x@y.z turns &lt;x (a) y z&gt;
      --slides        format output as presentation slides (used by -t art)
      --width=N       set the output's width to N columns (used by -t art)
      --height=N      set the output's height to N rows (used by -t art)
  -C, --config-file=F read configuration from file F
      --gui           invoke Graphical Tk Interface
  -q, --quiet         quiet mode, suppress all output (except errors)
  -v, --verbose       print informative messages during conversion
  -h, --help          print this help information and exit
  -V, --version       print program version and exit
      --dump-config   print all the configuration found and exit
      --dump-source   print the document source, with includes expanded

Turn OFF options:
     --no-css-inside, --no-css-sugar, --no-dump-config, --no-dump-source,
     --no-encoding, --no-enum-title, --no-headers, --no-infile,
     --no-mask-email, --no-outfile, --no-quiet, --no-rc, --no-slides,
     --no-style, --no-targets, --no-toc, --no-toc-only

Example:
     txt2tags -t html --toc file.t2t

By default, converted output is saved to 'infile.&lt;target&gt;'.
Use --outfile to force an output file name.
If  input file is '-', reads from STDIN.
If output file is '-', dumps output to STDOUT.
</PRE>

<P>
Please read the txt2tags man page for detailed information about options and command line use.
</P>
<P>
Examples:
</P>

<TABLE>
<TR>
<TD><B>Convert to HTML</B></TD>
<TD><CODE>$ txt2tags -t html file.t2t</CODE></TD>
</TR>
<TR>
<TD><B>The same, using redirection</B></TD>
<TD><CODE>$ txt2tags -t html -o - file.t2t &gt; file.html</CODE></TD>
</TR>
<TR>
<TD></TD>
<TD>.</TD>
</TR>
<TR>
<TD><B>Including Table Of Contents</B></TD>
<TD><CODE>$ txt2tags -t html --toc file.t2t</CODE></TD>
</TR>
<TR>
<TD><B>And also, numbering titles</B></TD>
<TD><CODE>$ txt2tags -t html --toc --enum-title file.t2t</CODE></TD>
</TR>
<TR>
<TD></TD>
<TD>.</TD>
</TR>
<TR>
<TD><B>Contents quick view</B></TD>
<TD><CODE>$ txt2tags --toc-only file.t2t</CODE></TD>
</TR>
<TR>
<TD><B>Maybe enumerate them?</B></TD>
<TD><CODE>$ txt2tags --toc-only --enum-title file.t2t</CODE></TD>
</TR>
<TR>
<TD></TD>
<TD>.</TD>
</TR>
<TR>
<TD><B>One liners from STDIN</B></TD>
<TD><CODE>$ echo -e "\n**bold**" | txt2tags -t html --no-headers -</CODE></TD>
</TR>
<TR>
<TD><B>Testing Mask Email feature</B></TD>
<TD><CODE>$ echo -e "\njohn.wayne@farwest.com" | txt2tags -t txt --mask-email --no-headers -</CODE></TD>
</TR>
</TABLE>

<A NAME="install"></A>
<H1>Part II - Install</H1>

<P>
Just download the program and run it on your machine.
</P>

<A NAME="download-python"></A>
<H2>Download &amp; Install Python</H2>

<P>
First of all, you must download and install <A HREF="http://www.python.org">Python</A> on
your system. Txt2tags requires Python version 2.2 or newer.
</P>
<P>
Note that Python is already installed by default in Linux and Mac systems. If you're using those, you're done, just skip this step.
</P>
<P>
If you are not sure if you have Python or not, open a console (tty,
xterm, MSDOS, Terminal.app) and type <CODE>python</CODE>. If it is not installed, the system
will tell you.
</P>

<A NAME="download-txt2tags"></A>
<H2>Download txt2tags</H2>

<P>
The official location for txt2tags distribution is on the program
site, at <A HREF="http://txt2tags.org">http://txt2tags.org</A>. Just download and uncompress the package (.tgz file).
</P>
<P>
If you're in Linux, you can also use the automatic installer of your system. Some examples:
</P>

<UL>
<LI>yum install txt2tags
<LI>sudo apt-get install txt2tags
</UL>

<A NAME="install-txt2tags"></A>
<H2>Install txt2tags</H2>

<P>
As a single Python script, txt2tags needs no installation at all.
</P>
<P>
The only file needed to use the program is the txt2tags script. The
other files of the package are documentation, tools and sample files.
</P>
<P>
The fail-proof way to run txt2tags, is calling Python with it:
</P>

<PRE>
prompt$ python txt2tags
</PRE>

<P>
If you want to install txt2tags on the system as a stand alone
program, just copy the txt2tags script to a system PATH
directory and make sure the system knows how to run it.
</P>

<DL>
<DT><B>UNIX/Linux/Mac</B></DT><DD>
  Make the script executable (<CODE>chmod +x txt2tags</CODE>) and copy it to a
  $PATH directory (<CODE>cp txt2tags /usr/local/bin</CODE>)
<P></P>
<DT><B>Windows</B></DT><DD>
  Rename the script adding the .py extension
  and copy it to a system PATH directory, such as <CODE>C:\Windows\System32</CODE>.
</DL>

<P>
After that, you can create an icon on your desktop for it, if you want to
use the program's Graphical Interface.
</P>

<A NAME="editor-syntax"></A>
<H2>Install Text Editor Syntax Highlighting File (optional)</H2>

<P>
Txt2tags comes with handy syntax highlighting files to be used by the
following text editors:
</P>

<UL>
<LI>Vim
<LI>Emacs
<LI>Nano
<LI>Kate
<LI>Gedit
<LI>JOE
<LI>le
<LI>ne
<LI>TextMate
</UL>

<P>
This syntax highlighting files have all the txt2tags rules and marks
registered, helping the user to write error-free documents. Showing the
marks in colors, you see on-the-fly if you wrote it right.
</P>

<TABLE ALIGN="center">
<TR>
<TD ALIGN="center"><center><IMG ALIGN="middle" SRC="./vim.png" BORDER="0" ALT=""></center></TD>
</TR>
<TR>
<TD ALIGN="center">Sample file opened in Vim Editor</TD>
</TR>
</TABLE>

<P>
Each editor has a different install procedure for a syntax highlighting
file, please read the syntax file headers and the editor documentation.
</P>

<A NAME="your-1st-doc"></A>
<H1>Part III - Writing and Converting Your First Document</H1>

<H2>Check the Tools</H2>

<P>
To make the first conversion you will need three things: txt2tags, a
text editor and a web browser.
</P>

<OL>
<LI>Make sure txt2tags is installed and running on your system.
<P></P>
  <UL>
  <LI><B>Command Line Interface:</B> Call "txt2tags" on the command line and
    the program should give you a "Missing input file" message. If it is
    not working, try <CODE>python /path/to/txt2tags</CODE> or even
    <CODE>/path/to/python /path/to/txt2tags</CODE> if Python is not on your PATH.
  <P></P>
  <LI><B>Gui Interface:</B> Click on the program icon to launch the Gui
    Interface or call <CODE>txt2tags --gui</CODE>.
  <P></P>
  </UL>
<LI>Open the text editor your are comfortable with. It can be <B>any</B> text
  editor, from the good old VI to MS Word or OpenOffice.org. Create a
  brand new empty document to be your first txt2tags one and remember to
  save it as plain text.
<P></P>
<LI>Launch your favorite web browser to see the results of the conversion.
</OL>

<H2>Write the Document Header</H2>

<OL>
<LI>Go to the text editor and on the very first line type the document
  main title: <I>My First Document</I>
<LI>On the second line make a subtitle, inserting this text:
  <I>A txt2tags test</I>
<LI>Then, on the third line, put some time information:
  <I>Sunday, 2004</I>
</OL>

<P>
If everything went right, you should be seeing a three line document
with this contents:
</P>

<PRE>
My First Document
A txt2tags test
Sunday, 2004
</PRE>

<P>
This is just a part of the document, but we can already convert it and
check the results.
</P>
<P>
Now save this document with the name <CODE>test.txt</CODE>. Remember to save it
as plain text. Pay attention to which folder you are saving the file,
you will need to remember it soon.
</P>

<H2>The First Conversion - Gui Interface</H2>

<P>
If you are in the Command Line Interface, please skip this step and read
the next one.
</P>
<P>
If you are in the Gui Interface, follow this steps:
</P>
    <center><IMG ALIGN="middle" SRC="./firstdoc.png" BORDER="0" ALT=""></center> 

<OL>
<LI>Press the "Browse" button and choose the <CODE>test.txt</CODE> you just saved
  (remember the folder!).
<LI>Back to the first screen, select "HTML page" on the "Target document
  type" combo.
<LI>Press the "Convert!" button.
</OL>

   <center><IMG ALIGN="middle" SRC="./firstdoc-done.png" BORDER="0" ALT=""></center> 
<P>
A dialog box will appear, telling you that the file was converted
successfully. Note that the generated HTML page was saved on the same
folder as the text file, with the "html" extension.
</P>

<H2>The First Conversion - Command Line Interface</H2>

<P>
If you are in the Command Line Interface, move to the folder where the
file was saved and type this command:
</P>

<PRE>
txt2tags --target html test.txt
</PRE>

<P>
The option <CODE>--target</CODE> is followed
by the "html" string, which tells the program to what format your text
file will be converted. The last item is the text filename.
</P>
<P>
The results were saved to the <CODE>test.html</CODE>
file and then the program will show you the
"<I>txt2tags wrote test.html</I>" message.
If some error occurred, read the message carefully.
</P>
<P>
Here is a sample of how it will be shown on your screen:
</P>

<PRE>
prompt$ txt2tags --target html test.txt
txt2tags wrote test.html
prompt$
</PRE>

<H2>Check the Results</H2>

<P>
Open the <CODE>test.html</CODE> file on the web browser to check if everything
is ok.
</P>
   <center><IMG ALIGN="middle" SRC="./firstdoc-html.png" BORDER="0" ALT=""></center> 
<P>
Here it is! You just typed three simple lines of text and txt2tags made
all the work to set the HTML page heading information, text alignment,
sizes, spacing and appearance. See that the main title is also placed at the
browser title bar.
</P>
	<BLOCKQUOTE>
	You write text, txt2tags does the rest ;)
	</BLOCKQUOTE>
<P>
Tip: You can also use CSS files on HTML pages generated by txt2tags, so the
page appearance is 100% configurable.
</P>

<H2>Writing the Document Body</H2>

<P>
Now back to the text editor, the next step is to type the document
contents. You can write plain text as you normally do on email messages.
You will see that txt2tags recognizes paragraphs and list of items
automatically, you don't have to "mark" them.
</P>
<P>
Then again: save it, convert and check the results. This is the
development cycle of a document in txt2tags. You just focus on the
document contents, finishing documents faster than other editors. No
mouse clicking, no menus, no windows, no distraction.
</P>
<P>
Considering the following contents for the <CODE>test.txt</CODE> file, which is
only plain text, compare the generated HTML page:
</P>

<PRE>
My First Document
A txt2tags test
Sunday, 2004

Well, let's try this txt2tags thing.
I don't know what to write.

Mmmmmm, I know what I need to do now:
- Take a shower
- Eat a pizza
- Sleep
</PRE>

   <center><IMG ALIGN="middle" SRC="./firstdoc-fullhtml.png" BORDER="0" ALT=""></center> 
<P>
You can write a full homepage with 0% of HTML knowledge. You don't need
to insert any tags. And more, the same text file can be converted to any
of the other txt2tags supported formats.
</P>
<P>
Besides plain text, txt2tags has some very simple marks, that you'll
use when you need some other formatting or structures like bold, italic,
title, images, table and other. As a quick sample,
<CODE>**stars for bold**</CODE> and <CODE>== equals for title ==</CODE>. You can learn the
marks on the <A HREF="http://txt2tags.org/markup.html">Txt2tags Markup Demo</A>.
</P>

<A NAME="concepts"></A>
<H1>Part IV - Mastering Txt2tags Concepts</H1>

<A NAME="areas"></A>
<H2>The .t2t document Areas</H2>

<P>
Txt2tags marked files are divided in 3 areas. Each area have its own
rules and purpose. They are:
</P>

<DL>
<DT><I>Header Area</I></DT><DD>
  Place for Document Title, Author, Version and Date information.
<DT><I>Config Area</I></DT><DD>
  Place for general Document Settings and Parser behavior modifiers.
<DT><I>Body Area</I></DT><DD>
  Place for the Document Content.
</DL>

<P>
All areas are optional. You can write a txt2tags document with just
headers (such as our first example), or a document with no headers or settings.
</P>
<P>
The areas are delimited by special rules, which will be seen in detail
on the next chapter. For now, this is a representation of the
areas on a document:
</P>

<PRE>
             ____________
            |            |
            |   HEADERS  |       1. First, the Headers
            |            |
            |   CONFIG   |       2. Then the Settings
            |            |
            |    BODY    |       3. And finally the Document Body,
            |            |
            |    ...     |          which goes until the end
            |    ...     |
            |____________|

</PRE>

<P>
In short, this is how the areas are defined:
</P>

<TABLE ALIGN="center">
<TR>
<TD ALIGN="center"><B>Headers</B></TD>
<TD>First 3 lines of the file, or the first line blank for No Headers.</TD>
</TR>
<TR>
<TD ALIGN="center"><B>Config</B></TD>
<TD>Begins right after the Header (4th or 2nd line) and ends when the <I>Body Area</I> starts.</TD>
</TR>
<TR>
<TD ALIGN="center"><B>Body</B></TD>
<TD>The first valid text line (not comment or setting) after the <I>Header Area</I>.</TD>
</TR>
</TABLE>

<H3>Full Example</H3>

<PRE>
My nice doc Title
Mr. John Doe
Last Updated: %%mtime(%c)

%!target  : html
%!style   : fancy.css
%!encoding: UTF-8
%!options : --toc --enum-title

Hi! This is my test document.
Its content will end here.
</PRE>

<A NAME="headers-area"></A>
<H2>Header Area</H2>

<P>
Location:
</P>

<UL>
<LI>Fixed position: <B>First 3 lines</B> of the file. Period.
<LI>Fixed position: <B>First line</B> of the file if it is blank. This
  means Empty Headers.
</UL>

<P>
The Header Area is the only one that has a fixed position, line
oriented. They are located at the first three lines of the source file.
</P>
<P>
These lines are content-free, with no static information type needed.
But the following is recommended:
</P>

<UL>
<LI><I>line 1</I>: document title
<LI><I>line 2</I>: author name and/or email
<LI><I>line 3</I>: document date and/or version
              (nice place for <CODE>%%date</CODE>)
</UL>

<P>
Keep in mind that the first 3 lines of the source document will be the
first 3 lines on the target document, separated and with high contrast
to the text body (i.e. big letters, bold). If paging is allowed, the
headers will be alone and centralized on the first page.
</P>

<H4>Less (or None) Header lines</H4>

<P>
Sometimes the user wants to specify less than three lines for headers,
giving just the document title and/or date information.
</P>
<P>
Just let the 2nd and/or the 3rd lines empty (blank) and this position
will not be placed at the target document. But keep in mind that even
blanks, these lines are still part of the headers, so the document body
must start <B>after</B> the 3rd line anyway.
</P>
<P>
The title is the only required header (the first line), but if you
leave it blank, you are saying that your document has <B>no headers</B>.
So the <I>Body Area</I> will begin right after, on the 2nd line.
</P>
<P>
No headers on the document is often useful if you want to specify your
own customized headers after converting. The command line option
<CODE>--no-headers</CODE> is usually required for this kind of operation.
</P>

<H4>Straight to the point</H4>

<P>
In short: <B>"Headers are just <U>positions</U>, not contents"</B>
</P>
<P>
Place one text on the first line, and it will appear on the target's
first line. The same for 2nd and 3rd header lines.
</P>

<A NAME="config-area"></A>
<H2>Config Area</H2>

<P>
Location:
</P>

<UL>
<LI>Begins right after the Header Area
  <UL>
  <LI>Begins on the <B>4th line</B> of the file if <B>Headers</B> were specified
  <LI>Begins on the <B>2nd line</B> of the file if <B>No Headers</B> were specified
  </UL>
<LI>Ends when the Body Area starts
  <UL>
  <LI>Ends by a non Setting, Blank or Comment line
  </UL>
</UL>

<P>
The Config Area is optional. An average user can write lots of txt2tags
files without even know it exists, but the experienced users will
enjoy the power and control it provides.
</P>
<P>
The Config Area is used to store document-specific settings, so you don't
have to type them on the command line when converting the document. For
example, you can set the default document target type and encoding.
</P>
<P>
Please read the <A HREF="#settings-overview">Settings section</A> for more
information about them.
</P>

<A NAME="body-area"></A>
<H2>Body Area</H2>

<P>
Location:
</P>

<UL>
<LI>Begins on the first valid text line of the file
  <UL>
  <LI>Headers, Settings and Comments are <B>not</B> valid text lines
  </UL>
<LI>Ends at the end of the file (EOF)
</UL>

<P>
The body is anything outside Headers and Config Areas.
</P>
<P>
The body holds the document contents and all formatting and structures
txt2tags can recognize. Inside the body you can also put comments for
<I>TODOs</I> and self notes.
</P>
<P>
You can use the <CODE>--no-headers</CODE> command line option to convert only the
document body, suppressing the headers. This is useful to set your own
headers on a separate file, then join the converted body.
</P>

<A NAME="settings-overview"></A>
<H2>Settings</H2>

<P>
Settings are special configurations placed at the source document's
Config Area that can affect the conversion process. Their syntax is:
</P>

<PRE>
%! keyword : value
</PRE>

<P>
List of valid keywords:
</P>

<TABLE ALIGN="center" BORDER="1">
<TR>
<TH>Keyword</TH>
<TH>Description</TH>
</TR>
<TR>
<TD ALIGN="center">Target</TD>
<TD>Set the default target to the document be converted to.</TD>
</TR>
<TR>
<TD ALIGN="center">Options</TD>
<TD>Set the default options to be used on the conversion. The format is the same as the command line options.</TD>
</TR>
<TR>
<TD ALIGN="center">Style</TD>
<TD>Set the document style. Used to define a CSS file for HTML/XHTML and to load a package in LaTeX.</TD>
</TR>
<TR>
<TD ALIGN="center">Encoding</TD>
<TD>Set the document Character Set. Used if the document contains accented letters or other not-ASCII characters.</TD>
</TR>
<TR>
<TD ALIGN="center">PreProc</TD>
<TD>Input filter. Sets "find and replace" rules to be applied on the Body Area of the source document.</TD>
</TR>
<TR>
<TD ALIGN="center">PostProc</TD>
<TD>Output filter. Sets "find and replace" rules to be applied on the converted document.</TD>
</TR>
</TABLE>

<P>
Example:
</P>

<PRE>
%!target  : html
%!options : --toc --toc-level 3
%!style   : fancy.css
%!encoding: UTF-8
%!preproc : "AMJ"        "Aurelio Marinho Jargas"
%!postproc: '&lt;BODY.*?&gt;'  '&lt;BODY bgcolor="yellow"&gt;'
</PRE>

<P>
Note that the spacing and capitalization of the keyword are ignored. So you can also do <CODE>%!Target:html</CODE> and  <CODE>%! TARGET :html</CODE>.
</P>
<P>
Learn more about settings in <A HREF="#settings">Part VII - Mastering Settings</A>.
</P>

<A NAME="options"></A>
<H2>Command Line Options</H2>

<P>
The fastest way of changing the txt2tags default behavior is to use
command line options. This options are available on the Command Line
Interface only, not on Gui or Web.
</P>
<P>
Just like the other system's tools, the program do accept a set of
predefined options. An option is an hyphen followed by a letter or two
hyphens followed by one or more words, like <CODE>-t</CODE> and <CODE>--target</CODE>.
</P>
<P>
Options that are generally used are <CODE>--outfile</CODE> to define a customized
output file name, <CODE>--toc</CODE> to turn on the automatic TOC generation and
<CODE>--encoding</CODE> to set the document character set. Most of the options
can be turned off prefixing a "no-" before its name, for example:
<CODE>--no-encoding</CODE> and <CODE>--no-toc</CODE>.
</P>
<P>
You can register the desired options for a source file inside its
Config Area, using the <CODE>%!options</CODE> setting. This way you don't have to
type them on the command line anymore.
Example:
</P>

<PRE>
%!options: --toc -o mydoc.html
</PRE>

<P>
The exception is the target specification, that has its own setting:
</P>

<PRE>
%!target: html
</PRE>

<P>
Use the <CODE>--help</CODE> option to get a complete list of all the options
available in txt2tags.
</P>
<P>
Learn more about <A HREF="#setting-options">%!options</A> and <A HREF="#setting-target">%!target</A>.
</P>

<A NAME="rc"></A>
<H2>User Configuration File (RC File)</H2>

<P>
The user configuration file (also called RC file) is a central place to
store the settings that will be shared by ALL converted files. If you
keep inserting the same settings on every .t2t file you write, move it
to the RC file and it will be used globally, for existing and future
source files.
</P>
<P>
The default location of this file depends on your system. It can also be
specified by the user, using an environment variable.
</P>

<TABLE ALIGN="center" BORDER="1">
<TR>
<TH COLSPAN="2">RC file location</TH>
</TR>
<TR>
<TD ALIGN="right">Windows</TD>
<TD><CODE>%HOMEPATH%\_t2trc</CODE></TD>
</TR>
<TR>
<TD>UNIX, Linux, Mac</TD>
<TD><CODE>$HOME/.txt2tagsrc</CODE></TD>
</TR>
<TR>
<TD ALIGN="right">User defined</TD>
<TD><CODE>T2TCONFIG</CODE> variable</TD>
</TR>
</TABLE>

<P>
The format of the settings is exactly the same as the ones used on the
.t2t files Config Area. There is a sample RC file on the package at
<CODE>doc/txt2tagsrc</CODE>. Example:
</P>

<PRE>
% my configs

%%% Always use CSS-friendly tags in HTML
%!options(html): --css-sugar

%%% Change the default TOC depth for all targets
%!options: --toc-level 4

%%% Set the default encoding for all documents
%!options: --encoding UTF-8
</PRE>

<P>
Any line that is not blank, a comment or a valid config line will raise
error when txt2tags runs. So be careful when editing this file.
</P>
<P>
Txt2tags automatically apply the RC file contents into any source file it
is converting. If you want to disable this behavior for a specific
file, use the <CODE>--no-rc</CODE> command line option.
</P>

<A NAME="config-loading"></A>
<H2>Configuration Loading Order and Precedence</H2>

<P>
There are three ways of telling txt2tags which options and settings to
use, and this is the order that they are read and applied:
</P>

<OL>
<LI>The user configuration file (RC) settings
<LI>The source document Config Area settings
<LI>The command line options
</OL>

<P>
First txt2tags reads the RC file contents (if any) and apply its
configurations on the current source file. Then it scans the source
document Config Area for settings and if found, they are applied also,
overriding the RC ones in case of conflict. Finally comes the command
line options, stronger than the other two.
</P>
<P>
So, if the document encoding was defined on the three resources, the
command line will be the one used.
</P>

<A NAME="include"></A>
<H2>%!include command</H2>

<P>
The <CODE>include</CODE> command is used to paste the contents of an external
file into the source document body. It is not a config, but a command,
and it is valid on the document Body Area.
</P>
<P>
The <CODE>include</CODE> command is useful to split a large document into smaller
pieces (like chapters in a book) or to include the full contents of an
external file into the document source. Sample:
</P>

<PRE>
My first book
Dr. John Doe
1st Edition

%!include: intro.t2t
%!include: chapter1.t2t
%!include: chapter2.t2t
...
%!include: chapter9.t2t
%!include: ending.t2t
</PRE>

<P>
You just inform the filename after the <CODE>%!include</CODE> string. The
optional target specification is also supported, so this is valid
either:
</P>

<PRE>
%!include(html): file.t2t
</PRE>

<P>
Note that include will insert the file Body Area into the source
document. The included file Header and Config Areas are ignored. This
way you can convert the included file alone or inside the main document.
</P>
<P>
But there's another three types of include:
</P>

<UL>
<LI>Verbatim include
<LI>Raw include
<LI>Tagged include
</UL>

<P>
The <B>Verbatim</B> type includes a text file preserving its original
spaces and formatting, just like if the text was inside the txt2tags
Verbatim area (```). To specify this type, enclose the filename with
backquotes:
</P>

<PRE>
%!include: ``/etc/fstab``
</PRE>

<P>
The <B>Raw</B> type includes a text file as is, not trying to find and
parse txt2tags marks on it, just like if the text was inside the Raw
area ("""). To specify this type, enclose the filename with double
quotes:
</P>

<PRE>
%!include: ""nice_text.txt""
</PRE>

<P>
And the <B>Tagged</B> type is passed directly to the resulting document,
with NO parsing or escaping performed by txt2tags. This way you can
include additional tagged parts to your document. Useful for default
header or footer information, or more complicated tagged code,
unsupported by txt2tags:
</P>

<PRE>
%!include(html): ''footer.html''
</PRE>

<P>
Note that the filename is enclosed with single quotes. As the text
inserted is already parsed, you should specify the target to avoid
mistakes.
</P>

<A NAME="includeconf"></A>
<H2>%!includeconf command</H2>

<P>
The <CODE>includeconf</CODE> command is used to include configurations from an
external file into the current one. This command is valid inside the
source document Config Area only.
</P>
<P>
It is useful to share the same config for multiple files, so you can
centralize it. On any file do you want to include that central
configuration, put a <CODE>includeconf</CODE> call. Example:
</P>

<PRE>
My First Document
John Doe
July, 2004

%!includeconf: config.t2t

Hi, this is my first document.
</PRE>

<P>
The format inside the included file is the same as in the
<A HREF="#rc">RC file</A>.
</P>
<P>
Note that the optional target specification is NOT supported for this command.
</P>

<PRE>
%!includeconf: config.t2t            &lt;--- OK
%!includeconf(html): config.t2t      &lt;--- NOT OK
</PRE>

<A NAME="marks"></A>
<H1>Part V - Mastering Marks</H1>

<P>
Overview of all txt2tags marks:
</P>

<TABLE ALIGN="center" BORDER="1">
<TR>
<TH COLSPAN="2">Basic</TH>
<TH COLSPAN="2">Beautifiers</TH>
</TR>
<TR>
<TD ALIGN="right"><I>Headers</I></TD>
<TD ALIGN="center">First 3 lines</TD>
<TD ALIGN="right"><I>Bold</I></TD>
<TD ALIGN="center">**words**</TD>
</TR>
<TR>
<TD ALIGN="right"><I>Title</I></TD>
<TD ALIGN="center">= words =</TD>
<TD ALIGN="right"><I>Italic</I></TD>
<TD ALIGN="center">//words//</TD>
</TR>
<TR>
<TD ALIGN="right"><I>Numbered title</I></TD>
<TD ALIGN="center">+ words +</TD>
<TD ALIGN="right"><I>Underline</I></TD>
<TD ALIGN="center">__words__</TD>
</TR>
<TR>
<TD ALIGN="right"><I>Paragraph</I></TD>
<TD ALIGN="center">words</TD>
<TD ALIGN="right"><I>Strike</I></TD>
<TD ALIGN="center">--words--</TD>
</TR>
<TR>
<TD ALIGN="right"><I>Links</I></TD>
<TD ALIGN="center">[label url]</TD>
<TD ALIGN="right"><I>Monospaced</I></TD>
<TD ALIGN="center">``words``</TD>
</TR>
<TR>
<TD ALIGN="right"><I>Image</I></TD>
<TD ALIGN="center">[filename.jpg]</TD>
<TD ALIGN="right"><I>Raw text</I></TD>
<TD ALIGN="center">""words""</TD>
</TR>
<TR>
<TD COLSPAN="2"></TD>
<TD ALIGN="right"><I>Tagged text</I></TD>
<TD ALIGN="center">''words''</TD>
</TR>
<TR>
<TH COLSPAN="4">Other</TH>
</TR>
<TR>
<TD ALIGN="right"><I>Quote</I></TD>
<TD ALIGN="center">&lt;TAB&gt;words</TD>
<TD ALIGN="right"><I>Separator line</I></TD>
<TD ALIGN="center"><S>--------</S>...</TD>
</TR>
<TR>
<TD ALIGN="right"><I>List</I></TD>
<TD ALIGN="center">- words</TD>
<TD ALIGN="right"><I>Strong line</I></TD>
<TD ALIGN="center">============...</TD>
</TR>
<TR>
<TD ALIGN="right"><I>Numbered list</I></TD>
<TD ALIGN="center">+ words</TD>
<TD ALIGN="right"><I>Table</I></TD>
<TD ALIGN="center">| cell1 | cell2 | cell3...</TD>
</TR>
<TR>
<TD ALIGN="right"><I>Definition list</I></TD>
<TD ALIGN="center">: words</TD>
<TD ALIGN="right"><I>Anchor</I></TD>
<TD ALIGN="center">= title =[anchor]</TD>
</TR>
<TR>
<TD ALIGN="right"><I>Comment line</I></TD>
<TD ALIGN="center">% comments</TD>
<TD ALIGN="right"><I>Comment area</I></TD>
<TD ALIGN="center">%%%\n comments \n%%%</TD>
</TR>
<TR>
<TD ALIGN="right"><I>Verbatim line</I></TD>
<TD ALIGN="center">``` word</TD>
<TD ALIGN="right"><I>Verbatim area</I></TD>
<TD ALIGN="center">```\n lines \n```</TD>
</TR>
<TR>
<TD ALIGN="right"><I>Raw line</I></TD>
<TD ALIGN="center">""" words</TD>
<TD ALIGN="right"><I>Raw area</I></TD>
<TD ALIGN="center">"""\n lines \n"""</TD>
</TR>
<TR>
<TD ALIGN="right"><I>Tagged line</I></TD>
<TD ALIGN="center">''' words</TD>
<TD ALIGN="right"><I>Tagged area</I></TD>
<TD ALIGN="center">'''\n lines \n'''</TD>
</TR>
</TABLE>

<P>
General Rules:
</P>

<UL>
<LI><B>Headers</B> are the first three document lines, marks are not interpreted.
<LI><B>Titles</B> are balanced "=" or "+" chars around the title text. The more chars, more deep is the title.
<LI><B>Beautifiers</B> don't accept spaces between the marks and its contents.
<LI>The <B>Comment</B> mark "%" must be at the line beginning (first column).
<LI><B>Images</B> filename must end in GIF, JPG, PNG or similar.
<LI>The only <B>multiline</B> marks are the Comment, Verbatim, Raw and Tagged areas.
<LI>No mark is <B>interpreted</B> inside Verbatim, Raw and Tagged.
<LI>The <B>Separator/Strong lines</B> must have at least 20 chars.
<LI>Quote and lists <B>(un)nesting</B> is defined by indent.
<LI>A <B>Table title</B> line is defined by two || at the beginning of the line.
</UL>

<A NAME="mark-headers"></A>
<H2>Headers</H2>

<UL>
<LI><B>Description:</B> Identifies the document headers
<LI><B>Properties:</B> Multiline, FreeSpaces, !Align, !Nesting
<LI><B>Contains:</B> Macros
<LI><B>Syntax:</B>
  <UL>
  <LI>The first 3 lines of the source file.
  <LI>Leave the first line blank to not specify headers at all.
    Nice for command line one-liners or customized headers.
  <LI>Leave the second and/or third lines blank to omit parts of header.
  </UL>
<LI><B>Details:</B>
  <UL>
  <LI>Marks are NOT interpreted
  <LI>The first 3 lines will be the first 3 lines on the target document,
    with high contrast to text body, or will be placed alone on the
    first page (if paging is allowed).
  <LI>The headers are content-free, with no static information type
    needed. But the following is recommended for the most documents:
    <UL>
    <LI>Line 1: Document title
    <LI>Line 2: Author name and/or email
    <LI>Line 3: Document date and/or version (nice place for %%mtime)
    </UL>
  </UL>
</UL>

<A NAME="mark-title"></A>
<H2>Title, Numbered Title</H2>

<UL>
<LI><B>Description:</B> Identifies a (numbered or not) section title
<LI><B>Properties:</B> !Multiline, FreeSpaces, !Align, !Nesting
<LI><B>Contains:</B> -
<LI><B>Syntax:</B>
  <UL>
  <LI>For Numbered Title, just change "=" by "+" on the following rules
  <LI>Balanced equal signs around, <CODE>=like this=</CODE>
  <LI>More signs, more sublevels: <CODE>=title=</CODE>, <CODE>==subtitle==</CODE>,
    <CODE>===subsubtitle===</CODE>, ...
  <LI>There is a maximum of 5 levels, <CODE>=====like this=====</CODE>
  <LI>Unbalanced equals are not title, <CODE>=like this===</CODE>
  <LI>Free spacing inside the marks are allowed, <CODE>=       like this  =</CODE>
  <LI>Titles can have an anchor <CODE>=like this=[anchor]</CODE>. To link to an anchor
    create a <CODE>[local link #anchor]</CODE>
  <LI>The anchor name can contain only letters, numbers, underscore
    and hyphen (A-Za-z0-9_-)
  </UL>
<LI><B>Details:</B>
  <UL>
  <LI>Marks are NOT interpreted
  <LI>Macros are NOT interpreted
  </UL>
</UL>

<A NAME="mark-paragraph"></A>
<H2>Paragraph</H2>

<UL>
<LI><B>Description:</B> Identifies a paragraph of text
<LI><B>Properties:</B> Multiline, FreeSpaces, !Align, !Nesting
<LI><B>Contains:</B> Macros, Beautifiers, Raw, Tagged, Links, Image, Comment
<LI><B>Syntax:</B>
  <UL>
  <LI>Paragraphs are groups of lines delimited by blank lines
  <LI>Other blocks like lists, quote, table or verbatim also ends a
    paragraph
  </UL>
</UL>

<A NAME="mark-comment"></A>
<H2>Comment</H2>

<UL>
<LI><B>Description:</B> Used to insert text that will not appear on the target
  document
<LI><B>Properties:</B> !Multiline, !FreeSpaces, !Align, !Nesting
<LI><B>Contains:</B> -
<LI><B>Syntax:</B>
  <UL>
  <LI>A line beginning with a percent char at the first column, <CODE>% like this</CODE>
  <LI>NO leading spaces
  </UL>
<LI><B>Details:</B>
  <UL>
  <LI>As comments, they're not showed on the converted text
  <LI>Not a block, so each comment line must begin with %
  <LI>Useful for TODO and FIXME reminders and editor's notes
  </UL>
</UL>

<A NAME="mark-comment-block"></A>
<H2>Comment Area</H2>

<UL>
<LI><B>Description:</B> Used to insert text that will not appear on the target
  document
<LI><B>Properties:</B> Multiline, !FreeSpaces, !Align, !Nesting
<LI><B>Contains:</B> -
<LI><B>Syntax:</B>
  <UL>
  <LI>A line with exactly 3 consecutive percents <CODE>%%%</CODE>, followed by
    text lines, followed by another line with exactly 3 consecutive
    percents <CODE>%%%</CODE>
  <LI>NO spaces allowed before or after the marks
  </UL>
<LI><B>Details:</B>
  <UL>
  <LI>As comments, they're not showed on the converted text
  <LI>Useful for deactivate (not delete) large portions of the contents
  <LI>If the end of the source file (EOF) is hit, the opened Comment Area
    is closed
  </UL>
</UL>

<A NAME="mark-beautifiers"></A>
<H2>Bold, Italic, Underline, Strike</H2>

<UL>
<LI><B>Description:</B> Used to insert a bold/italic/underline/strike text inside a
  paragraph, table, list or quote
<LI><B>Properties:</B> !Multiline, !FreeSpaces, !Align, Nesting
<LI><B>Contains:</B> Macros, Beautifiers, Raw, Tagged, Links, Image
<LI><B>Syntax:</B>
  <UL>
  <LI>Two starts around for bold, <CODE>**like this**</CODE>
  <LI>Two slashes around for italic, <CODE>//like this//</CODE>
  <LI>Two underlines around for underline, <CODE>__like this__</CODE>
  <LI>Two hyphens around for strike, <CODE>--like this--</CODE>
  <LI>The marks must be glued with the contents (no spaces):
    <CODE>** this ** is invalid</CODE>
  </UL>
<LI><B>Details:</B>
  <UL>
  <LI>All the beautified text must be on a single line of the source file,
    no line breaks inside
  <LI>Macros are allowed inside beautifiers: <CODE>**%%date**</CODE>
  <LI>You can mix beautifiers one inside another,
    <CODE>""**__like__ //this//**""</CODE>
  </UL>
</UL>

<A NAME="mark-monospaced"></A>
<H2>Monospaced</H2>

<UL>
<LI><B>Description:</B> Used to insert a monospaced text inside a paragraph, table,
  list or quote
<LI><B>Properties:</B> !Multiline, !FreeSpaces, !Align, !Nesting
<LI><B>Contains:</B> -
<LI><B>Syntax:</B>
  <UL>
  <LI>Two backquotes around, <CODE>``like this``</CODE>
  <LI>The marks must be glued with the contents (no spaces):
    <CODE>`` this `` is invalid</CODE>
  </UL>
<LI><B>Details:</B>
  <UL>
  <LI>Marks are NOT interpreted
  <LI>Macros are NOT interpreted
  <LI>All the monospaced text must be on a single line of the source file,
    no line breaks inside
  <LI>In some targets, the internal spacing is maintained, in others the
    consecutive spaces are squeezed to one
  <LI>You can make a bold monospaced text enclosing it inside bold marks:
    <CODE>""**</CODE>monobold<CODE>**""</CODE>. The same applies to the other beautifiers
    such as <CODE>""//</CODE>italic<CODE>//""</CODE> and <CODE>""__</CODE>underline<CODE>__""</CODE>.
  </UL>
</UL>

<A NAME="mark-verbatim"></A>
<H2>Verbatim Line, Verbatim Area</H2>

<UL>
<LI><B>Description:</B> Used to insert programming codes or other pre-formatted text,
  preserving spacing and line breaks, and using a monospaced font
<LI><B>Properties:</B> Multiline, !FreeSpaces, !Align, !Nesting
<LI><B>Contains:</B> -
<LI><B>Syntax:</B> <B>Verbatim Line:</B>
  <UL>
  <LI>A line beginning with 3 consecutive backquotes, followed by a space,
    followed by the text, <CODE>""`</CODE>"" like this``
  <LI>The backquotes must be at the start of the line, no spaces before
  </UL>
<LI><B>Syntax:</B> <B>Verbatim Area:</B>
  <UL>
  <LI>A line with exactly 3 consecutive backquotes <CODE>```</CODE>, followed by
    text lines, followed by another line with exactly 3 consecutive
    backquotes <CODE>```</CODE>
  <LI>NO spaces allowed before or after the marks
  </UL>
<LI><B>Details:</B>
  <UL>
  <LI>Marks are NOT interpreted
  <LI>Macros are NOT interpreted
  <LI>If the end of the source file (EOF) is hit, the opened Verbatim Area
    is closed
  </UL>
</UL>

<A NAME="mark-separator"></A>
<H2>Separator Line, Strong Line</H2>

<UL>
<LI><B>Description:</B> Identifies a separator or strong line
<LI><B>Properties:</B> !Multiline, FreeSpaces, !Align, !Nesting
<LI><B>Contains:</B> -
<LI><B>Syntax:</B>
  <UL>
  <LI>The separator line can be composed by dashes "-" or underscores "_"
  <LI>The strong line is composed by equals "="
  <LI>Use at least least 20 dashes/underscores/equal signs
  <LI>Optional spaces can be placed at the line start or end
  <LI>Any other characters on the line invalidate the mark
  </UL>
<LI><B>Details:</B>
  <UL>
  <LI>If the target does not have separator line support, a commented line
    is used instead
  <LI>The strong line may have different behaviors on some targets:
    <UL>
    <LI>A larger separator line
    <LI>A pause on presentation formats, like MagicPoint
    <LI>A page break in paged targets, like LaTeX
    </UL>
  </UL>
</UL>

<A NAME="mark-link"></A>
<H2>Links, Named Links</H2>

<UL>
<LI><B>Description:</B> Identifies a remote (Internet) or local link
<LI><B>Properties:</B> !Multiline, !FreeSpaces, !Align, !Nesting
<LI><B>Contains:</B> Macros, Raw, Tagged, Image
<LI><B>Syntax:</B>
  <UL>
  <LI>Any valid internet URL, ftp, news or email address is detected and
    converted automatically
  <LI>The protocol (http, https, ftp) is optional, <CODE>www.likethis.com</CODE>
  <LI>A name can be used for a link: <CODE>[click here www.url.com]</CODE>
  <LI>An image can point to a link: <CODE>[[image.jpg] www.url.com]</CODE>
  <LI>Macros are allowed on the link address: <CODE>[see source %%infile]</CODE>
  <LI>Macros are allowed on the link name: <CODE>[mirror of %%outfile www.url.com]</CODE>
  <LI>All the link specification must be on a single line of the source
    file, no line breaks inside
  </UL>
<LI><B>Details:</B>
  <UL>
  <LI>If the target does not have link support, they're just underlined
  </UL>
</UL>

<A NAME="mark-quote"></A>
<H2>Quote</H2>

<UL>
<LI><B>Description:</B> Identifies a quoted (indented) line
<LI><B>Properties:</B> Multiline, !FreeSpaces, !Align, Nesting
<LI><B>Contains:</B> Macros, Beautifiers, Quote, Raw, Tagged, Bars, Links, Image, Comment
<LI><B>Syntax:</B>
  <UL>
  <LI>A line that starts with a tabulation (TAB) character
  <LI>More TABs at the start increase the quote depth
  <LI>Lists and tables are not allowed inside quote
  </UL>
<LI><B>Details:</B>
  <UL>
  <LI>If the end of the source file (EOF) is hit, the opened Quote is
    closed
  <LI>Some targets may not support quote nesting, then the subquotes lines
    are moved up to the mother quote level.
  <LI>There is not a limit for subquotes depth. But some targets may have
    restrictions, so the subquotes than are deeper than the maximum level
    are moved up.
  </UL>
</UL>

<A NAME="mark-lists"></A>
<H2>List, Numbered List, Definition List</H2>

<UL>
<LI><B>Description:</B> Identifies the start of a list item
<LI><B>Properties:</B> Multiline, !FreeSpaces, !Align, Nesting
<LI><B>Contains:</B> Macros, Beautifiers, Lists, Table, Verbatim, Raw, Tagged, Bars, Links, Image, Comment
<LI><B>Syntax:</B>
  <UL>
  <LI>A line that starts with a dash/plus/colon followed by exactly one
    space
  <LI>The first list char can NOT be a space (exception: definition
    lists)
  <LI>Optional spaces (regular spaces, not TAB) at the line beginning
    define sublists depth (nesting)
  <LI>Sublists end with a less depth item (from parent list) or with an
    empty item
  <LI>All opened lists are closed with two consecutive blank lines
  </UL>
<LI><B>Details:</B>
  <UL>
  <LI>If the end of the source file (EOF) is hit, all opened lists are
    closed
  <LI>Lists can be mixed, like a definition list inside a numbered list.
  <LI>Some targets may not support list nesting, then the sublists items
    are moved up to the mother list level.
  <LI>There is not a limit for sublists depth. But some targets may have
    restrictions, so the sublists than are deeper than the maximum level
    are moved up.
  </UL>
</UL>

<A NAME="mark-image"></A>
<H2>Image</H2>

<UL>
<LI><B>Description:</B> Identifies an image
<LI><B>Properties:</B> !Multiline, !FreeSpaces, Align, !Nesting
<LI><B>Contains:</B> Macros
<LI><B>Syntax:</B>
  <UL>
  <LI>An image filename enclosed between brackets, <CODE>[likethis.jpg]</CODE>
  <LI>The filename must end in an image extension like PNG, JPG, GIF,
    ... (case doesn't matter)
  <LI>Symbols are allowed on the filename, <CODE>[likethis!~1.jpg]</CODE>
  <LI>Macros are allowed on the filename, <CODE>[report-%%date(%Y-%m-%d).png]</CODE>
  <LI>NO spaces allowed on the filename, <CODE>[like this.jpg]</CODE>
  <LI>NO spaces allowed on the brackets, <CODE>[ likethis.jpg ]</CODE>
  </UL>
<LI><B>Details:</B>
  <UL>
  <LI>If the target does not have image support, the image filename is
    shown inside (parenthesis).
  <LI>The position of the mark on the line defines the image alignment:
    <UL>
    <LI><CODE>[LEFT.jpg]</CODE> blablablabla
    <LI>blablablabla <CODE>[CENTER.jpg]</CODE> blablablabla
    <LI>blablablabla <CODE>[RIGHT.jpg]</CODE>
    </UL>
  </UL>
</UL>

<A NAME="mark-table"></A>
<H2>Table</H2>

<UL>
<LI><B>Description:</B> Delimits a table row, with any number of columns
<LI><B>Properties:</B> Multiline, FreeSpaces, Align, !Nesting
<LI><B>Contains:</B> Macros, Beautifiers, Raw, Tagged, Links, Image, Comment
<LI><B>Syntax:</B>
  <UL>
  <LI>A leading pipe "|" identifies a table row
  <LI>A leading double pipe "||" identifies a table title row
  <LI>Leading spaces before first pipe identifies table centered align
  <LI>The fields are separated by the " | " string (space pipe space)
  <LI>A final pipe "|" at the first table row sets visible borders
  <LI>A final pipe "|" at the other table rows are ignored (just cosmetic)
  <LI>Closing a cell with more than one pipe "|" identifies column span:
    "||" for 2 columns, "|||" for 3 and so on
  <LI>Natural spaces inside each cell identifies its alignment
  <LI>Example: <CODE>| table | row | with | five | columns |</CODE>
  </UL>
<LI><B>Details:</B>
  <UL>
  <LI>All the table row data must be on a single line of the source file,
    no line breaks inside
  <LI>Targets with column-oriented align (like sgml and LaTeX), uses the
    first table row align as the default for the other rows
  <LI>Any non-table line closes the opened table, except comment lines
  <LI>The cell count is flexible, each table row can have a different
    number of cells
  <LI>Currently there's no way to specify row span
  <LI>If the target does not have table support, the table lines are
    considered a Verbatim Area
  </UL>
</UL>

<A NAME="mark-raw"></A>
<H2>Raw, Raw Line, Raw Area</H2>

<UL>
<LI><B>Description:</B> Used to "protect" some text from parsing, so marks and macros inside
  it will not be expanded. But escapes are applied.
<LI><B>Properties:</B> !Multiline, !FreeSpaces, !Align, !Nesting
<LI><B>Contains:</B> -
<LI><B>Syntax:</B> <B>Raw:</B>
  <UL>
  <LI>Two double quotes around, <CODE>""like this""</CODE>
  <LI>Marks glued with the contents (no spaces)
  </UL>
<LI><B>Syntax:</B> <B>Raw Line:</B>
  <UL>
  <LI>A line beginning with 3 consecutive double quotes, <CODE>""" like this</CODE>
  <LI>The double quotes must be at the start of the line, no spaces before
  <LI>Use a space after the double quotes to separate them from the text
  </UL>
<LI><B>Syntax:</B> <B>Raw Area:</B>
  <UL>
  <LI>A line with exactly 3 consecutive double quotes, followed by text
    lines, followed by another line with exactly 3 consecutive
    double quotes
  <LI>NO spaces allowed before or after the marks
  </UL>
<LI><B>Details:</B>
  <UL>
  <LI>Marks are NOT interpreted
  <LI>Macros are NOT interpreted
  <LI>If the end of the source file (EOF) is hit, the opened Raw Area is
    closed
  </UL>
</UL>

<A NAME="mark-tagged"></A>
<H2>Tagged, Tagged Line, Tagged Area</H2>

<UL>
<LI><B>Description:</B> Used to send text directly to the output, no parsing or escaping is made by txt2tags.
<LI><B>Properties:</B> !Multiline, !FreeSpaces, !Align, !Nesting
<LI><B>Contains:</B> -
<LI><B>Syntax:</B> <B>Tagged:</B>
  <UL>
  <LI>Two apostrophes around, <CODE>''like this''</CODE>
  <LI>Marks glued with the contents (no spaces)
  </UL>
<LI><B>Syntax:</B> <B>Tagged Line:</B>
  <UL>
  <LI>A line beginning with 3 consecutive apostrophes, <CODE>''' like this</CODE>
  <LI>The apostrophes must be at the start of the line, no spaces before
  <LI>Use a space after the apostrophes to separate them from the text
  </UL>
<LI><B>Syntax:</B> <B>Tagged Area:</B>
  <UL>
  <LI>A line with exactly 3 consecutive apostrophes, followed by text
    lines, followed by another line with exactly 3 consecutive
    apostrophes
  <LI>NO spaces allowed before or after the marks
  </UL>
<LI><B>Details:</B>
  <UL>
  <LI>Marks are NOT interpreted
  <LI>Macros are NOT interpreted
  <LI>If the end of the source file (EOF) is hit, the opened Tagged Area is
    closed
  <LI>Use this mark to insert target code. For example, in HTML you could use
    it to insert manual line breaks <CODE>''&lt;br&gt;''</CODE>,
    custom DIVs <CODE>''&lt;div id="myfooter"&gt;''</CODE> or even full blocks of code,
    like the Google Analytics tracking code.
  </UL>
</UL>

<A NAME="macros"></A>
<H1>Part VI - Mastering Macros</H1>

<P>
Macros are special purpose keywords, that are expanded on conversion
time. They are used to insert dynamic information, for example the
current date or information about the document source.
</P>
<P>
A macro is represented by the <CODE>%%</CODE> chars followed by its name, such as
<CODE>%%date</CODE>. Some macros do accept an optional formatting string inside
parenthesis, right after the macro name, such as <CODE>%%date(%Y-%m-%d)</CODE>. This
format string mixes common text with special directives, identified by a
percent sign % followed by an identification character. If no format
string is given, the default format is used.
</P>

<TABLE ALIGN="center" BORDER="1">
<TR>
<TH>Macro Name</TH>
<TH>Expands to...</TH>
<TH>Default Format</TH>
</TR>
<TR>
<TD>%%date</TD>
<TD>The current date</TD>
<TD ALIGN="center">%Y%m%d</TD>
</TR>
<TR>
<TD>%%mtime</TD>
<TD>The source file modification time</TD>
<TD ALIGN="center">%Y%m%d</TD>
</TR>
<TR>
<TD>%%infile</TD>
<TD>The source file path</TD>
<TD ALIGN="center">%f</TD>
</TR>
<TR>
<TD>%%outfile</TD>
<TD>The output file path</TD>
<TD ALIGN="center">%f</TD>
</TR>
<TR>
<TD>%%toc</TD>
<TD>The document TOC (Table of Contents)</TD>
<TD ALIGN="center">-</TD>
</TR>
</TABLE>

<P>
General rules:
</P>

<UL>
<LI>The macro name is case-insensitive, so <CODE>%%date</CODE>, <CODE>%%DaTe</CODE> and
  <CODE>%%DATE</CODE> are identical
<LI>Macros are valid at the document Header Area and Body Area, except
  %%toc that is valid on Body Area only
<LI>A macro starts the Body Area if it is found in the Config Area
<LI>A macro can be placed at any part of the line, including various per line
  (except %%toc, valid when alone in a line)
<LI>A macro can be used inside links and images marks (except %%toc)
<LI>Macros are not expanded in Titles, Verbatim, Raw and Tagged Areas
</UL>

<P>
Full example (bold text are expanded macros):
</P>
<P>
This is the Txt2tags User Guide, converted to <B>html</B>
by txt2tags from the <B>userguide.t2t</B> source file. The conversion
was done at <B>2010-11-04 08:09:04</B>, but the last change on the
source document was made on <B>2010-10-31 00:26:16</B>. Both
source and converted file reside on the <B>userguide</B>
directory.
</P>

<A NAME="macro-date"></A>
<H2>%%date</H2>

<P>
The <CODE>%%date</CODE> macro expands to the current date and time. It is very
useful on the document headers or footer, to register the date when the
document was generated. To expand to the source document last
modification time, see the <A HREF="#macro-mtime">%%mtime macro</A>.
</P>
<P>
This macros accepts several formatting directives. The full list can be
found in the
<A HREF="http://docs.python.org/library/time.html">Python site</A>.
Here are the most commonly used:
</P>

<TABLE ALIGN="center" BORDER="1">
<TR>
<TH>Directive</TH>
<TH>Description</TH>
</TR>
<TR>
<TD ALIGN="center">%a</TD>
<TD>Locale's abbreviated weekday name.</TD>
</TR>
<TR>
<TD ALIGN="center">%A</TD>
<TD>Locale's full weekday name.</TD>
</TR>
<TR>
<TD ALIGN="center">%b</TD>
<TD>Locale's abbreviated month name.</TD>
</TR>
<TR>
<TD ALIGN="center">%B</TD>
<TD>Locale's full month name.</TD>
</TR>
<TR>
<TD ALIGN="center">%c</TD>
<TD>Locale's appropriate date and time representation.</TD>
</TR>
<TR>
<TD ALIGN="center">%d</TD>
<TD>Day of the month as a decimal number [01,31].</TD>
</TR>
<TR>
<TD ALIGN="center">%H</TD>
<TD>Hour (24-hour clock) as a decimal number [00,23].</TD>
</TR>
<TR>
<TD ALIGN="center">%I</TD>
<TD>Hour (12-hour clock) as a decimal number [01,12].</TD>
</TR>
<TR>
<TD ALIGN="center">%m</TD>
<TD>Month as a decimal number [01,12].</TD>
</TR>
<TR>
<TD ALIGN="center">%M</TD>
<TD>Minute as a decimal number [00,59].</TD>
</TR>
<TR>
<TD ALIGN="center">%p</TD>
<TD>Locale's equivalent of either AM or PM.</TD>
</TR>
<TR>
<TD ALIGN="center">%S</TD>
<TD>Second as a decimal number [00,61].  (1)</TD>
</TR>
<TR>
<TD ALIGN="center">%x</TD>
<TD>Locale's appropriate date representation.</TD>
</TR>
<TR>
<TD ALIGN="center">%X</TD>
<TD>Locale's appropriate time representation.</TD>
</TR>
<TR>
<TD ALIGN="center">%y</TD>
<TD>Year without century as a decimal number [00,99].</TD>
</TR>
<TR>
<TD ALIGN="center">%Y</TD>
<TD>Year with century as a decimal number.</TD>
</TR>
<TR>
<TD ALIGN="center">%%</TD>
<TD>A literal "%" character.</TD>
</TR>
</TABLE>

<P>
Examples:
</P>

<TABLE ALIGN="center" BORDER="1">
<TR>
<TH>Macro</TH>
<TH>--&gt;</TH>
<TH>Results for on 2010, Nov 04 at 08:09</TH>
</TR>
<TR>
<TD>%%date(Converted on: %c)</TD>
<TD ALIGN="center">--&gt;</TD>
<TD>Converted on: Thu Nov  4 08:09:04 2010</TD>
</TR>
<TR>
<TD>%%date(%Y-%m-%d)</TD>
<TD ALIGN="center">--&gt;</TD>
<TD>2010-11-04</TD>
</TR>
<TR>
<TD>%%date(%I:%M %p)</TD>
<TD ALIGN="center">--&gt;</TD>
<TD>08:09 AM</TD>
</TR>
<TR>
<TD>%%date(Today is %A, on %B.)</TD>
<TD ALIGN="center">--&gt;</TD>
<TD>Today is Thursday, on November.</TD>
</TR>
</TABLE>

<A NAME="macro-mtime"></A>
<H2>%%mtime</H2>

<P>
The <CODE>%%mtime</CODE> macro expands to last modification time of the source
document. It is useful to register when the file was last changed.
This macro is a "sister" of the <A HREF="#macro-date">%%date macro</A>, so it
accepts exactly the same formatting directives.
</P>
<P>
As an example, this User Guide source file was last edited on
<B>Sun Oct 31 00:26:16 2010</B>. This date was expanded from <CODE>%%mtime(%c)</CODE>.
</P>

<A NAME="macro-infile"></A>
<H2>%%infile</H2>

<P>
The <CODE>%%infile</CODE> macro expands to the source file location on the
system. It is useful to make those "<I>see the source of this file</I>"
links on HTML pages. Providing such link is a friendly attitude with
beginners, so they can use your source as a sample for their own page.
</P>
<P>
This macro accepts the following formatting directives:
</P>

<TABLE ALIGN="center" BORDER="1">
<TR>
<TH>%&lt;char&gt;</TH>
<TH>Description</TH>
<TH>Output for this User Guide source</TH>
</TR>
<TR>
<TD ALIGN="center">%f</TD>
<TD>File name</TD>
<TD>userguide.t2t</TD>
</TR>
<TR>
<TD ALIGN="center">%F</TD>
<TD>File name (without extension)</TD>
<TD>userguide</TD>
</TR>
<TR>
<TD ALIGN="center">%e</TD>
<TD>File extension</TD>
<TD>t2t</TD>
</TR>
<TR>
<TD ALIGN="center">%p</TD>
<TD>Absolute file path</TD>
<TD>/a/txt2tags/svn/doc/English/userguide/userguide.t2t</TD>
</TR>
<TR>
<TD ALIGN="center">%d</TD>
<TD>File path (directories only)</TD>
<TD>/a/txt2tags/svn/doc/English/userguide</TD>
</TR>
<TR>
<TD ALIGN="center">%D</TD>
<TD>File path (parent dir only)</TD>
<TD>userguide</TD>
</TR>
<TR>
<TD ALIGN="center">%%</TD>
<TD>Literal percent char</TD>
<TD>%</TD>
</TR>
</TABLE>

<P>
Examples:
</P>

<TABLE ALIGN="center" BORDER="1">
<TR>
<TH>Source</TH>
<TH>--&gt;</TH>
<TH>Expanded</TH>
</TR>
<TR>
<TD>This Guide parent dir is %%infile(%D).</TD>
<TD ALIGN="center">--&gt;</TD>
<TD>This Guide parent dir is userguide.</TD>
</TR>
<TR>
<TD>I do use the %%infile(%e) file extension.</TD>
<TD ALIGN="center">--&gt;</TD>
<TD>I do use the t2t file extension.</TD>
</TR>
<TR>
<TD>[See the source %%infile]</TD>
<TD ALIGN="center">--&gt;</TD>
<TD><A HREF="userguide.t2t">See the source</A></TD>
</TR>
<TR>
<TD>Converted to XHTML, I'll be %%infile(%F).xhtml</TD>
<TD ALIGN="center">--&gt;</TD>
<TD>Converted to XHTML, I'll be userguide.xhtml</TD>
</TR>
</TABLE>

	<BLOCKQUOTE>
	<B>Note:</B> The macro is expanded to "-" if the source file is STDIN.
	</BLOCKQUOTE>

<A NAME="macro-outfile"></A>
<H2>%%outfile</H2>

<P>
The <CODE>%%outfile</CODE> macro expands to the converted file location on the
system. It is useful to its name inside the document Body or Headers.
This macro is a sister of the <A HREF="#macro-infile">%%infile macro</A> and
do accept exactly the same formatting directives.
</P>
<P>
Examples:
</P>

<TABLE ALIGN="center" BORDER="1">
<TR>
<TH>Source</TH>
<TH>--&gt;</TH>
<TH>Expanded</TH>
</TR>
<TR>
<TD>You are reading the %%outfile file.</TD>
<TD ALIGN="center">--&gt;</TD>
<TD>You are reading the userguide.html file.</TD>
</TR>
<TR>
<TD>txt2tags -t %%outfile(%e) -i %%infile -o %%outfile</TD>
<TD ALIGN="center">--&gt;</TD>
<TD>txt2tags -t html -i userguide.t2t -o userguide.html</TD>
</TR>
</TABLE>

	<BLOCKQUOTE>
	<B>Note:</B> The macro is expanded to "-" if the output file is STDOUT.
	</BLOCKQUOTE>

<A NAME="macro-toc"></A>
<H2>%%toc</H2>

<P>
The <CODE>%%toc</CODE> macro expands to the document's Table of Contents. It is
useful for you to specify exactly where you want the TOC to be placed.
You can even use the macro more than one time and place the TOC at the
end of the document also, for example. This Guide is using %%toc
to position the TOC.
</P>
<P>
Different from the other macros, this one does not accept a format
string and has its own special rules:
</P>

<UL>
<LI>Valid at the document Body Area only
<LI>Must be alone on the line (leading and trailing spaces are allowed)
<LI>Must be used together with --toc command line option, or it will be
  ignored
<LI>The default automatic TOC positioning/formatting is disabled when a
  %%toc is found
</UL>

<A NAME="settings"></A>
<H1>Part VII - Mastering Settings</H1>

<P>
Settings are special configurations placed at the source document's
Config Area that can affect the conversion process. The Settings are all
optional. The average user can live fine without them. But they are
addictive, if you start using them, you'll never stop :)
</P>
<P>
Setting lines are <I>special comment lines</I>, marked by a leading
identifier ("!") that makes them different from plain comments. The
syntax is just as simple as variable setting, composed by a keyword
and a value, separated from each by a colon (":").
</P>
	<BLOCKQUOTE>
	<B>%! keyword : value</B>
	</BLOCKQUOTE>
<P>
Syntax details:
</P>

<UL>
<LI>The exclamation mark must be placed together with the comment char
  (%!), no spaces between them.
<P></P>
<LI>The spaces around the keyword and the separator are optional.
<P></P>
<LI>Keywords are case insensitive (case doesn't matter).
</UL>

<P>
Rules:
</P>

<UL>
<LI>Settings are valid only inside the Config Area, and are considered
  plain comments if found on the document Body.
<P></P>
<LI>If the same keyword appears more than one time on the Config Area, the
  last found will be the one used. Exception: options, preproc and
  postproc, which are cumulative.
<P></P>
<LI>A setting line with an invalid keyword will be considered a plain
  comment line.
<P></P>
<LI>This settings have precedence over RC file, but not on command line
  options.
</UL>

<A NAME="setting-target"></A>
<H2>%!target</H2>

<P>
Using the target setting, a default target format is defined for the
document:
</P>

<PRE>
%!target: html
</PRE>

<P>
This way the user can just call
</P>

<PRE>
$ txt2tags file.t2t
</PRE>

<P>
And the conversion will be done, to the specified target.
</P>
<P>
The target setting does not support optional target specification.
That doesn't make sense, such as <CODE>%!target(tex): html</CODE>.
</P>

<A NAME="setting-options"></A>
<H2>%!options</H2>

<P>
Writing long command lines every time you need to convert a document
is boring and error prone. The Options setting let the user save
all the converting options together with the source document. This also
ensures that the document will always be converted the same way, with
the same options.
</P>
<P>
Just write it with no syntax errors, as you were on the real command
line. But omit the "txt2tags" program call on the beginning, the target
specification and the source filename from the ending.
</P>
<P>
For example, if you do use this command line to convert your document:
</P>

<PRE>
$ txt2tags -t html --toc --toc-level 2 --enum-title file.t2t
</PRE>

<P>
You can save yourself from typing pain using this Options setting inside
the document source:
</P>

<PRE>
%!target: html
%!options(html): --toc --toc-level 2 --enum-title
</PRE>

<P>
Now the options are registered inside the source file, so you can convert it with this simple command:
</P>

<PRE>
$ txt2tags file.t2t
</PRE>

	<BLOCKQUOTE>
	Tip for Vim users: To convert the document right inside the editor, just run <CODE>:!txt2tags %</CODE>
	</BLOCKQUOTE>

<A NAME="setting-encoding"></A>
<H2>%!encoding</H2>

<P>
The Encoding setting is needed by non-english writers, who uses
accented letters and other locale specific details, so the target
document <I>Character Set</I> must be customized (if allowed).
</P>
<P>
The valid values for the Encoding setting are the same charset names
valid for HTML documents, like <I>iso-8859-1</I> and <I>koi8-r</I>. If
you're not sure which encoding you should use, try <I>utf-8</I>. If that doesn't work,
<A HREF="http://www.iana.org/assignments/character-sets">this complete (and long!) list</A>
should help.
</P>
<P>
The LaTeX target uses alias names for encoding. This is not a problem
for the user, because txt2tags translate the names internally. Some
examples:
</P>

<TABLE ALIGN="center" BORDER="1">
<TR>
<TH>txt2tags/HTML</TH>
<TH>&gt;</TH>
<TH>LaTeX</TH>
</TR>
<TR>
<TD>windows-1250</TD>
<TD>&gt;&gt;&gt;</TD>
<TD>cp1250</TD>
</TR>
<TR>
<TD>windows-1252</TD>
<TD>&gt;&gt;&gt;</TD>
<TD>cp1252</TD>
</TR>
<TR>
<TD>ibm850</TD>
<TD>&gt;&gt;&gt;</TD>
<TD>cp850</TD>
</TR>
<TR>
<TD>ibm852</TD>
<TD>&gt;&gt;&gt;</TD>
<TD>cp852</TD>
</TR>
<TR>
<TD>iso-8859-1</TD>
<TD>&gt;&gt;&gt;</TD>
<TD>latin1</TD>
</TR>
<TR>
<TD>iso-8859-2</TD>
<TD>&gt;&gt;&gt;</TD>
<TD>latin2</TD>
</TR>
<TR>
<TD>koi8-r</TD>
<TD>&gt;&gt;&gt;</TD>
<TD>koi8-r</TD>
</TR>
</TABLE>

<P>
If the value is unknown to txt2tags, it will be passed "as is",
allowing the user to specify custom encodings.
</P>

<A NAME="setting-preproc"></A>
<H2>%!preproc</H2>

<P>
The PreProc is an input filter that changes the Body Area of the source document. It is a "find
and replace" feature, applied right after the line is read from the
document source, before any parsing by txt2tags.
</P>
<P>
It is useful to define some abbreviations for common typed text, as:
</P>

<PRE>
%!preproc: JJS          "John J. Smith"
%!preproc: RELEASE_DATE "2003-05-01"
%!preproc: BULLET       "[images/tiny/bullet_blue.png]"
</PRE>

<P>
So the user can write a line like:
</P>

<PRE>
Hi, I'm JJS. Today is RELEASE_DATE.
</PRE>

<P>
And txt2tags will "see" this line as:
</P>

<PRE>
Hi, I'm John J. Smith. Today is 2003-05-01.
</PRE>

<P>
This filter is a component that acts between the document author
and the txt2tags conversion. It's like a first conversion before the
"real" one. This behavior is similar to an external Sed/Perl filter,
called this way:
</P>

<PRE>
$ cat file.t2t | preproc-script.sh | txt2tags -
</PRE>

<P>
So the txt2tags parsing will begin after all the PreProc substitutions
were applied.
</P>
	<BLOCKQUOTE>
	<B>Note:</B> Remember that the preprocessing is applied only to the BODY of the source document, not including the Header Area and Config Area.
	</BLOCKQUOTE>

<A NAME="setting-postproc"></A>
<H2>%!postproc</H2>

<P>
The PostProc is an output filter that changes the converted document. It is a
"find and replace" feature, applied after all txt2tags parsing and
processing is done.
</P>
<P>
It is useful to do some refinements on the generated document, change
tags and add extra text or tags. Quick samples:
</P>

<PRE>
%!postproc(html): '&lt;BODY.*?&gt;' '&lt;BODY BGCOLOR="green"&gt;'
%!postproc(tex) : "\\newpage" ""
</PRE>

<P>
These filters change the background color of the HTML page and remove
the page breaks on the LaTeX target.
</P>
<P>
The PostProc rules are just like an external Sed/Perl filter, called
this way:
</P>

<PRE>
$ txt2tags -t html -o- file.t2t | postproc-script.sh &gt; file.html
</PRE>

<P>
Before this feature was introduced, it was very common to have little
scripts to "adjust" the txt2tags results. These scripts were in fact
just lots of sed (or alike) commands, to do "substitute this for that"
actions. Now this replacement strings can be saved together with the
document text, and the plus is to use the Python powerful Regular
Expression machine to find patterns.
</P>

<A NAME="setting-style"></A>
<H2>%!style</H2>

<UL>
<LI>Useful in HTML and XHTML targets, it defines a CSS file for the target
  document.
<P></P>
<LI>Useful in LaTeX target, to load <CODE>\usepackage</CODE> modules.
<P></P>
<LI>The same effect is achieved with the command line option <CODE>--style</CODE>.
<P></P>
<LI>The --style option is stronger than %!style. If both are used, --style
  wins.
</UL>

<A NAME="setting-specific"></A>
<H2>Defining a Setting for a Specific Target</H2>

<P>
All the settings (except %!target) can be glued with a specific target
using the <CODE>%!key(target): value</CODE> syntax. This way user can define
different config for different targets.
</P>
<P>
This is specially useful in the pre/postproc filters, but is applicable
to all settings. For example, defining different styles for HTML and
LaTeX:
</P>

<PRE>
%!style(html): fancy.css
%!style(tex) : amssymb
</PRE>

<P>
For the options setting it's very useful to adjust the converted
document:
</P>

<PRE>
%!target: sgml
%!options(sgml): --toc
%!options(html): --style foo.css
%!options(txt ): --toc-only --toc-level 2
</PRE>

<P>
In this example, the default target is Sgml and it will use TOC. If the
user run <CODE>txt2tags -t html file.t2t</CODE>, only the HTML options will be
used, so the converted file will use "foo.css" style file and will
have no TOC.
</P>

<A NAME="filters-details"></A>
<H2>Details for PreProc and PostProc Filters</H2>

<UL>
<LI>Filters are a "find and replace" feature (think SED)
<P></P>
<LI>Filters do not follow the "last found, one used" schema, they're
  cumulative. You can define as many filters as needed, with no limit.
  They will be applied on the same order as defined.
<P></P>
<LI>Different from other settings, both the target specific filters and
  the generic ones (all targets) are used. On the following example,
  both filters are used on the HTML target:
<PRE>
%!postproc      :   this   that
%!postproc(html):   that   other
</PRE>

<P></P>
<LI>The filters must receive exactly TWO arguments
<P></P>
<LI>Special escapes as <CODE>\n</CODE> (line break) and <CODE>\t</CODE> (tabulation) are
  interpreted
<P></P>
<LI>To delete some text, change it by an empty string
<PRE>
%!postproc: "undesired string" ""
</PRE>

<P></P>
<LI>To avoid problems, always use the explicit target form when using
  PostProc to change tags: <CODE>%!postproc(target): &lt;this&gt; &lt;that&gt;</CODE>
<P></P>
<LI>PREproc is applied right after the line is read, and POSTproc is
  applied after all the parsing was made. This is similar to
  (UUOC ahead):
<PRE>
$ cat file.t2t | preproc.sh | txt2tags | postproc.sh
</PRE>

<P></P>
<LI>The first part of a filter (the "search for" part) is not read as a
  regular string, but as a Regular Expression pattern. If you don't know
  what these expressions do, don't worry, you may never have to. Just
  keep in mind that you will need to "escape" some characters to use
  them. To escape is to prefix the character with a backslash "\". Here
  is the list:
<PRE>
\*  \+  \.  \^  \$  \?  \(  \)  \{  \[  \|  \\
</PRE>

<P></P>
<LI>Python Regular Expressions are available! They're similar to Perl
  Regexes (PCRE). Example: Change all opening and closing "B" tags to
  "STRONG" on HTML:
<PRE>
%!postproc(html):   '(&lt;/?)B&gt;'   '\1STRONG&gt;'
</PRE>

<P></P>
<LI>The filter arguments can be passed on 3 ways:
    <OL>
    <LI>A single unquoted word such as FOO (no spaces)
    <LI>A string double quoted such as "FOO"
    <LI>A string single quoted such as 'FOO'
    <P></P>
    </OL>
<LI>If your pattern has double quotes, protect it with single quotes and
  vice-versa. Some valid samples:
<PRE>
%!postproc:   PATT    REPLACEMENT
%!postproc:  "PATT"  "REPLACEMENT"
%!postproc:  'PATT'  'REPLACEMENT'
%!postproc:   PATT   "REPLACEMENT"
%!postproc:  "PATT"  'REPLACEMENT'
</PRE>

</UL>

<A NAME="black-magic"></A>
<H1>Part VIII - Black Magic</H1>

<P>
This chapter is really not recommended for newbies. It demonstrates how
to do strange things with txt2tags filters, abusing of complex
patterns and Regular Expressions.
</P>
	<BLOCKQUOTE>
	<B>BEWARE!</B> The following procedures are NOT encouraged and can
	break things. Even some text from the document source can be
	lost on the conversion process, not appearing on the target
	document. Just use these tactics if you really need them and
	know what you are doing.
	</BLOCKQUOTE>
	<BLOCKQUOTE>
	<B>Note:</B> Filters are a powerful feature, but can be dangerous!
	</BLOCKQUOTE>
	<BLOCKQUOTE>
	<B>Note:</B> Bad filters do generate unexpected results.
	</BLOCKQUOTE>
<P>
Keep that in mind, please.
</P>

<A NAME="postproc-multiline"></A>
<H2>Inserting Multiple Lines with %!postproc (such as CSS rules)</H2>

<P>
In filters, the replacement pattern can include multiple lines using the
<CODE>\n</CODE> line break char.
</P>
<P>
This can be handy for including really short CSS rules on HTML target,
with no need to create a separate file:
</P>

<PRE>
%!postproc: &lt;HEAD&gt;      '&lt;HEAD&gt;\n&lt;STYLE TYPE="text/css"&gt;\n&lt;/STYLE&gt;'
%!postproc: (&lt;/STYLE&gt;)  'body     { margin:3em               ;} \n\1'
%!postproc: (&lt;/STYLE&gt;)  'a        { text-decoration:none     ;} \n\1'
%!postproc: (&lt;/STYLE&gt;)  'pre,code { background-color:#ffffcc ;} \n\1'
%!postproc: (&lt;/STYLE&gt;)  'th       { background-color:yellow  ;} \n\1'
</PRE>

<P>
All the filters are tied to the first one, by replacing a string that it
has inserted. So a single "&lt;HEAD&gt;" turns to:
</P>

<PRE>
&lt;HEAD&gt;
&lt;STYLE TYPE="text/css"&gt;
body     { margin:3em               ;}
a        { text-decoration:none     ;}
pre,code { background-color:#ffffcc ;}
th       { background-color:yellow  ;}
&lt;/STYLE&gt;
</PRE>

<A NAME="target-specific-contents"></A>
<H2>Creating "Target-Specific" Contents with %!preproc</H2>

<P>
Sometimes you need to insert some text on a specific target, but not on
the others. This kind of strange behavior can be done using some
PreProc tricks.
</P>
<P>
The idea is to insert this extra text on the document source as
comments, but mark it in a way that a target-specific filter will
"uncomment" those lines.
</P>
<P>
For example, if an extra paragraph must be added only in HTML target.
Place the text as special comments, like this:
</P>

<PRE>
%html% This HTML page is Powered by [txt2tags http://txt2tags.org].
%html% See the source TXT file [here source.t2t].
</PRE>

<P>
As those lines start with <CODE>%</CODE>, they are plain comments lines and will be
ignored. But when adding this special filter:
</P>

<PRE>
%preproc(html): '^%html% ' ''
</PRE>

<P>
The leading string is removed and those lines will be "activated", not
being comments anymore. As a explicit target config, this filter will be
processed for HTML targets only.
</P>

<A NAME="creating-marks"></A>
<H2>Changing Txt2tags Marks with %!preproc</H2>

<P>
Being a Regular Expressions guru, the user can customize the document
source syntax, changing the txt2tags default marks to some he find more
comfortable.
</P>
<P>
For example, a leading TAB is the Quotation mark. If the user doesn't
like it, or his text editor has some strange relationship with TABs, he
can define a new mark for Quoted text. Say a leading "&gt;&gt;&gt; " was his
choice. Then he will do this simple filter:
</P>

<PRE>
%!preproc: '^&gt;&gt;&gt; ' '\t'
</PRE>

<P>
And on the document source, the quoted text will be something like:
</P>

<PRE>
&gt;&gt;&gt; This is a quoted text.
&gt;&gt;&gt; The user defined this strange mark.
&gt;&gt;&gt; But they will be converted to TABs by PreProc.
</PRE>

<P>
Before the parsing begins, the strange "&gt;&gt;&gt; " will be converted to
TABs and txt2tags will recognize the Quote mark.
</P>
	<BLOCKQUOTE>
	<B>BEWARE!</B> Extreme PreProc rules could eventually
	change the entire marks syntax, even generating conflicts
	between marks. Be really really careful when doing this.
	</BLOCKQUOTE>

<H1>The End</H1>

<P>
Thanks for reading! :)
</P>
<P>
<A HREF="http://txt2tags.org">http://txt2tags.org</A>
</P>
<P>
(<A HREF="userguide.t2t">see source</A>)
<IMG ALIGN="middle" SRC="../../img/t2tpowered.png" BORDER="0" ALT="">
</P>
</DIV>

<!-- html code generated by txt2tags 2.6 (http://txt2tags.org) -->
<!-- cmdline: txt2tags userguide.t2t -->
</BODY></HTML>
